fix(encode): 32-bit safe pack header check#64
Merged
Conversation
Signed-off-by: linfeng.ouyang <fyoylf@gmail.com>
Contributor
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a 32-bit platform overflow issue in the pack header encoding logic by replacing a shift-based upper bound check with an explicit u32::MAX comparison.
Key Changes
- Replaced
assert!(object_number < (1 << 32))withassert!(object_number <= u32::MAX as usize)to avoid overflow on 32-bit platforms while maintaining equivalent semantics
genedna
approved these changes
Jan 4, 2026
31 tasks
yueneiqi
added a commit
to yueneiqi/git-internal
that referenced
this pull request
Jan 4, 2026
Signed-off-by: linfeng.ouyang <fyoylf@gmail.com>
Merged
genedna
pushed a commit
to genedna/git-internal
that referenced
this pull request
Mar 15, 2026
Signed-off-by: linfeng.ouyang <fyoylf@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
u32::MAXto avoid 32-bit overflowTesting
cargo build --target i686-unknown-linux-gnuThis PR was primarily authored with Codex using GPT-5.2-Codex and then hand-reviewed by me. I AM responsible for every change made in this PR. I aimed to keep it aligned with our goals, though I may have missed minor issues. Please flag anything that feels off, I'll fix it quickly.